﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SIPO.master" AutoEventWireup="true" CodeFile="rptPostinglist.aspx.cs" Inherits="reports_Transaction_rptHistoryTransaction" %>


<asp:Content ID="Content1" ContentPlaceHolderID="body" Runat="Server">
    <link type="text/css" rel="stylesheet" href="<%= ResolveUrl("~/styles/ui.jqgrid.css") %>" />
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/i18n/grid.locale-id.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/scripts/jquery.jqGrid.min.js") %>"></script>
    <script src="<%= ResolveUrl("~/scripts/helper.js") %>" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#btnCancel").button({ icons: { primary: "ui-icon-close"} });
            $("#btnSubmit").button({ icons: { primary: "ui-icon-circle-arrow-e"} });
            $("#btnPosting").button({ icons: { primary: "ui-icon-pencil"} });
            $("#btnCancel").click(function () {



            });

            var date = new Date();
            var currentMonth = date.getMonth();
            var currentDate = date.getDate();
            var currentYear = date.getFullYear();




            var IsLoad = true;


            var handleUrl = '<%= ResolveUrl("~/ajaxhandler/transaction/recBillinghandler.ashx") %>';
            $('#table').jqGrid({
                url: handleUrl + '?method=getdatapostreport&periodeawal=&periodeakhir=',
                datatype: 'json',
                colNames: ['NoTrans', 'Nama Debitur', 'Sektor', 'Jenis Transaksi', 'Tanggal Transaksi', 'Jumlah'],
                colModel: [
                { name: 'BillingNo', hidden: true, index: 'BillingNo', align: 'center', searchoptions: { sopt: ['eq', 'cn'] }, width: 200 },
               { name: 'recDebtor.DebtorName', index: 'debtorname', align: 'left', width: 200 },
                { name: 'ForPayment', index: 'FORPAYMENT', align: 'left', width: 200 },
                { name: 'UpdatedBy', index: 'FORPAYMENT', align: 'left', searchoptions: { sopt: ['eq', 'cn'] }, width: 200 },
                { name: 'BillingDate', index: 'BILLINGDATE', align: 'center', width: 200, formatter: 'date', formatoptions: { newformat: 'd M Y'} },

                { name: 'PaymentValue', index: 'VALUE', align: 'right', searchoptions: { sopt: ['eq', 'cn'] }, width: 200, formatter: 'currency', formatoptions: { decimalSeparator: ".", thousandsSeparator: ",", decimalPlaces: 2} }
                //                { name: 'PaymentValue', index: 'PAYMENTVALUE', align: 'right', searchoptions: { sopt: ['eq', 'cn'] }, width: 200, formatter: 'currency', formatoptions: { decimalSeparator: ".", thousandsSeparator: ",", decimalPlaces: 2} },
                         	],
                rowNum: 999999999,
                id: 'BillingNo',
                multiselect: true,
               // rowList: [100, 200, 300, 400],
                pager: '#pager',
                sortname: 'Bilno',
                sortorder: "asc",
                viewrecords: true,
                //  shrinkToFit: false,
                jsonReader: { repeatitems: false },
                width: 850,
                height: 300,
                caption: 'Verifikasi & Posting',
                ajaxGridOptions: { cache: false },
                ondblClickRow: function () {

                }
            });
            $("#btnCancel").click(function () {
                $("#<%=ddlJenisTrans.ClientID %>").val('-- semua jenis transaksi --');
                jQuery("#table").setGridParam({ url: '<%= ResolveUrl("~/AjaxHandler/Transaction/recBillinghandler.ashx") %>' + '?method=getdatapostreport' });
                jQuery("#table").trigger("reloadGrid", [{ page: 1}]);
            });


            $("#btnPosting").click(function () {
                var grid = $('#table');
                var selIds = grid.jqGrid('getGridParam', 'selarrrow'),
                selText = [];
                $.each(selIds, function () {
                    selText.push(grid.jqGrid('getCell', this, 'BillingNo'));
                });
                if (selIds.length > 0) {
                    var obj = new Object();
                    obj.ID = encodeURIComponent(selText);
                    jsonData = JSON.stringify(obj);
                    CallAjax('<%= ResolveUrl("~/ajaxhandler/transaction/recBillinghandler.ashx") %>', '?method=posting', jsonData);
                    setTimeout("$('#table').trigger('reloadGrid');", 3000);

                }
                else {

                    alert("Pilih data untuk di posting !");
                }
            });





            $("#<%=ddlJenisTrans.ClientID %>").change(function () {

                jQuery("#table").setGridParam({ url: '<%= ResolveUrl("~/AjaxHandler/Transaction/recBillinghandler.ashx") %>' + '?method=getdatapostreport&param=' + $("#<%=ddlJenisTrans.ClientID %>").val() });
                jQuery("#table").trigger("reloadGrid", [{ page: 1}]);
                //alert($("#<%=ddlJenisTrans.ClientID %>").val())
            });

        });
    </script>
<table border="0">

        <tr>
            <td style="width: 96px; text-align: left; height: 38px;">
           
                        Jenis Transaksi</td>
            <td style="height: 38px; width: 15px;">
                        :
                    </td>
            <td align="left" style="height: 38px">
                <asp:DropDownList ID="ddlJenisTrans" runat="server" Height="22px" Width="218px">
                </asp:DropDownList>
                <br />
            </td>

        </tr>

<%--<tr>
            <td style="width: 96px; text-align: left; height: 33px;">
           
                        Jenis Transaksi</td>
            <td style="height: 33px; width: 15px;">
                        :</td>
            <td align="left">
                <asp:DropDownList ID="ddlJenisPungutan" runat="server" Height="22px" Width="174px">
                </asp:DropDownList>
            </td>

        </tr>--%>
        </table>
        <br />
    <%-- <button class="dialog_link ui-state-default ui-corner-all" id="btnSubmit" type="button">
                        Lanjut
                    </button>   --%>
                      <button class="dialog_link ui-state-default ui-corner-all" id="btnPosting" type="button">
                        Posting
                    </button> 
                     <button class="dialog_link ui-state-default ui-corner-all" id="btnCancel" type="button">
                        Batal
                    </button>
                   
    <br />
    <br />
    <table id="table" class="scroll" cellpadding="0" cellspacing="0""  >
    
    </table>
    <div id="pager" class="scroll">
    </div>
    <br />
    <div id="dialog" title="Default dialog">
    </div>
    
     
  
    </asp:Content>

